﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Yxinmt.SmarterStreaming
{
    /// <summary>
    /// 播放配置
    /// </summary>
    public class SmartPlayerConfig
    {
        /// <summary>
        /// RTMP/RTSP/本地flv地址
        /// </summary>
        public string PlayUrl { get; set; }
        /// <summary>
        /// 缓冲时间 BufferTime(毫秒)
        /// </summary>
        public int BufferTime { get; set; }
        /// <summary>
        /// 低延迟模式
        /// </summary>
        public bool IsLowLatency { get; set; }
        /// <summary>
        /// RTSP-TCP
        /// </summary>
        public bool IsRtspTcp{get;set;}
        /// <summary>
        /// 快速启动
        /// </summary>
        public bool IsFastStartup { get; set; }
        /// <summary>
        /// 静音
        /// </summary>
        public bool IsMute { get; set; }

        public bool IsLog { get; set; }

        /// <summary>
        /// 本地录像
        /// </summary>
        public LocalRecorder LocalRecorder { get; set; }

        public SmartPlayerConfig()
        {
            LocalRecorder = new LocalRecorder();
        }

        public static SmartPlayerConfig Clone(SmartPlayerConfig config)
        {
            SmartPlayerConfig entity = new SmartPlayerConfig();

            entity.BufferTime = config.BufferTime;
            entity.IsFastStartup = config.IsFastStartup;
            entity.IsLog = config.IsLog;
            entity.IsLowLatency = config.IsLowLatency;
            entity.IsMute = config.IsMute;
            entity.IsRtspTcp = config.IsRtspTcp;
            entity.LocalRecorder.FileNamePrefix = config.LocalRecorder.FileNamePrefix;
            entity.LocalRecorder.IsAppendDate = config.LocalRecorder.IsAppendDate;
            entity.LocalRecorder.IsAppendTime = config.LocalRecorder.IsAppendTime;
            entity.LocalRecorder.RecordDir = config.LocalRecorder.RecordDir;
            entity.LocalRecorder.SingleRecordMaxFileSize = config.LocalRecorder.SingleRecordMaxFileSize;
            entity.PlayUrl = config.PlayUrl;

            return entity;
        }
    }
}
